<?php
// +----------------------------------------------------------------------
// | Citrix [ WE ONLY DO WHAT IS NECESSARY ]
// +----------------------------------------------------------------------
// | Copyright (c) 2018 http://www.tpCitrix.com/ All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.tpCitrix.com/ )
// +----------------------------------------------------------------------
// | Author: Citrix < 2722279500@qq.com >
// +----------------------------------------------------------------------

namespace app\index\controller;

use \think\Db;
use \think\Cache;
use \think\Cookie;
use \think\Session;
use app\index\controller\Base;
class About extends Base
{
	
    public function __construct()
    {
        parent::__construct();
        $cate_model = Db::name('about_cate');
       	$about_cate = $cate_model->where('pid',0)->order('sort DESC')->select();
       	if(!empty($about_cate))
       	{
       		foreach ($about_cate as $k => $v) 
       		{
       			$about_cate[$k]['cate2'] = $cate_model->where('pid',$about_cate[$k]['id'])->order('sort DESC')->select();
       			if(!empty($about_cate[$k]['cate2']))
       			{
       				foreach ($about_cate[$k]['cate2'] as $key => $value) 
       				{
       					$about_cate[$k]['cate2'][$key]['cate3'] = $cate_model->where('pid',$about_cate[$k]['cate2'][$key]['id'])->order('sort DESC')->select();
       				}
       			}
       		}
       	}
       	$this->about_cate = $about_cate;
        $this->assign('cur',"about");
        $this->assign('about_cate',$about_cate);
    }
    public function index()
    {
      	$cate_id = input('cate_id/d',$this->about_cate[0]['id']);
      	$about = Db::name('about')->where(['status'=>1,'about_cate_id'=>$cate_id])->order('sort DESC')->find();
        $this->assign('web_title',$about['title'].'-企业介绍');
        $this->assign('about',$about);
        $this->assign('cate_id',$cate_id);
        return $this->fetch();
    }
}